﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using XLua;

/// <summary>
/// 消息类
/// </summary>
namespace Al_FrameWork
{
    [LuaCallCSharp]
    public class MessageData
    {
        public MessageCenterEventType Type //发送的消息类型
        {
            get;
            private
            set;
        }

        public object Data //消息主体
        {
            get;
            private set;
        }

        /// <summary>
        /// 方法
        /// </summary>
        public Action action;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="type">消息类型</param>
        /// <param name="body">消息体</param>
        public MessageData(MessageCenterEventType type, object data, Action action_ = null)
        {
            Type = type;
            Data = data;
            if (action_ != null)
            {
                action = action_;
            }
        }
    }

    /// <summary>
    /// 用户事件类型，必须按照类型，顺序添加，合理命名规范
    /// </summary>
    [LuaCallCSharp]
    public enum MessageCenterEventType
    {
        /// <summary>
        /// 游戏更新检测
        /// </summary>
        GAME_UPDATE_CHECK_FINISH = 0,

        /// <summary>
        /// 通知下载进度
        /// </summary>
        UPDATE_DOWNLOAD_PROGRESS = 1,

        /// <summary>
        /// AB包下载完毕
        /// </summary>
        GAME_DOWNLOAD_AB_FINISH = 2,
    }
}